package com.sgb.kjwl.view.ui.adapter.home;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ItemHomeServiceIpCopyrightBinding;
import com.sgb.kjwl.model.entity.enterprise.CopyrightListEntity2;
import com.sgb.kjwl.utils.PointUtils;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class HomeIpCopyrightAdapter extends BaseRecycleAdapter<CopyrightListEntity2> {

    public HomeIpCopyrightAdapter(Context context, List<CopyrightListEntity2> datas) {
        super(context, R.layout.item_home_service_ip_copyright, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, CopyrightListEntity2 copyrightListEntity2) {
        ItemHomeServiceIpCopyrightBinding binding = (ItemHomeServiceIpCopyrightBinding) holder.getmBinding();
        binding.setViewModel(copyrightListEntity2);
        TextView tv_tag = holder.getItem().findViewById(R.id.tv_item_intel_prop_publish);
        switch (copyrightListEntity2.getPublishType()) {
            case 0://个人
                tv_tag.setText("个人");
                tv_tag.setBackgroundResource(R.drawable.shape_radius_1_solid_bule);
                break;
            case 1://企业
                tv_tag.setText("企业");
                tv_tag.setBackgroundResource(R.drawable.shape_radius_1_solid_bule);
                break;
            case 2://团队
                tv_tag.setText("团队");
                tv_tag.setBackgroundResource(R.drawable.ractangle_radius_1_solid_yellow);
                break;
            default:
                tv_tag.setVisibility(View.GONE);
                break;
        }
        binding.price.setText(copyrightListEntity2.getPrice() != -1 ? "¥" + PointUtils.price(copyrightListEntity2.getPrice()) : "议价");
    }
}
